/**
 * 公共工具js
 */
var projectPath=$(".projectPath").val();
var loadingImgPath=projectPath+"/assets/img/loading.gif";
 document.write("<script src="+projectPath+"/assets/js-lib/bootstrap/js/bootstrap.min.js></script>");

	//学年
function getAcadYearData(e) {
    var t = [], n = (new Date).getFullYear();
    if ((new Date).getMonth() < 7)
        n--;
    if (!e)
        e = 10;
    for (var r = -1; r < e; r++) {
        t.push({
            value : n - r,
            text : n - r + "-" + (n - r + 1)
        })
    }
    return t;
}
//
//年级
function getGradeYearData(e) {
    var t = [], n = (new Date).getFullYear();

    if (!e)
        e = 10;
    for (var r = -1; r < e; r++) {
        t.push({
            value : n - r,
            text : n - r
        })
    }
    return t;
}
$(function () {
    $("#modal").on("hidden.bs.modal", function() {
        $(this).removeData("bs.modal");
    });
    //解决session过期后shiro拦截页面ajax请求失效的问题
    $(document).ajaxComplete(function(event, xhr, settings) {
        if (xhr.getResponseHeader('Session-Status') == 'timeout') {
            if (xhr.getResponseHeader('Login-Path')) {
                window.location.replace(xhr.getResponseHeader('Login-Path'));
            } else {
                alert("用户会话已过期，请重新登录!");
            }
        } else if(403 == xhr.status) {
            window.location.reload();
        }
    });
});
